<?php
class Application_Form_AddNews extends Zend_Form
{

	public function init()
	{
		$this->setName('addflower');
		$tieude = new Zend_Form_Element_Text('tieude');
		$tieude->setLabel('Tiêu đề :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$img_name = new Zend_Form_Element_Text('img_name');
		$img_name->setLabel('Tên file ảnh :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$noidung=new Zend_Form_Element_Textarea('noidung');
		$noidung->setLabel('Nội dung :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton');
		
		$reset = new Zend_Form_Element_Reset('reset');
		
		
		//create select connect to loaigiohoa datatable
		$loai_id= new Zend_Form_Element_Select('loaibaiviet_id');
		$loai_id->setLabel('Loại bài viết :');
		$loai_data= new Application_Model_LoaiBaiViet();
		$loai_table=$loai_data->fetchAll()->toArray();
		foreach ($loai_table as $value)
		{
			$loai_id->addMultiOption($value['id'],$value['tenloai']);
		}
		//end

		$this->addElements(array($loai_id,$tieude,$img_name,$noidung,$reset, $submit));
	}
}